package com.mc.mcgoweb.thread.threadinterrupt;

public class ThreadInterrupt {
    public static final Object MONITOR = new Object();

    public static void main(String[] args) throws InterruptedException {

        Thread thread = new Thread(() -> {
            while (true) {
                try {
                    synchronized (MONITOR) {
                        MONITOR.wait(10);
                    }

                } catch (InterruptedException e) {
                    e.printStackTrace();

                }

            }
        });
        thread.start();
        Thread.sleep(100);
        System.out.println(thread.isInterrupted());
        thread.interrupt();
        System.out.println(thread.isInterrupted());
    }
}
